package main

import (
    "fmt"
    "os"
    "os/signal"
    "syscall"
)

// 监听全部信号
func main()  {
    //合建chan
    c := make(chan os.Signal, 1)
    //监听所有信号
    signal.Notify(c, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGKILL)
    //阻塞直到有信号传入
    fmt.Println("启动")
    s := <-c
    fmt.Println("退出信号", s)
}
